package com.crazymaker.cloud.nacos.demo.consumer.client;

import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @description:远程服务的本地声明式接口
 */

@FeignClient(
        value = "service-provider-demo", path = "/service-provider-demo/echo"
)
public interface EchoClient {
    /**
     * 远程调用接口的方法:
     * 调用   demo-provider 的  REST 接口  api/demo/echo/{0}/v1
     * REST 接口 功能： 回显输入的信息
     *
     * @return echo 回显消息 JSON 响应实例
     */
    @RequestMapping(value = "/param",
            method = RequestMethod.GET)
    JSONObject echo(@RequestParam(value = "p1", required = false) String param1,
                    @RequestParam(value = "p2", required = false) String param2);

}
